home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-25 | 583 b | 28 lines | [TEXT/EDIT] |
- //-------------------------------------------------------------------//
-
- // Syntax: num2str ( N )
-
- // Description:
-
- // Num2str converts the scalar-numeric argument into a string, which
- // is the return value.
- //-------------------------------------------------------------------//
-
- num2str = function ( N )
- {
- local (s)
-
- if (class (N) == "num" && type (N) == "real")
- {
- if (N.n == 1)
- {
- sprintf (s, "%.4g", N);
- return s
- else
- error ("num2str: argument must be scalar");
- }
- else
- error ("num2str: argument must be numeric-real");
- }
- };
-